<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html ng-app="LeaderboardApp">
<head>
<meta charset="UTF-8">
<title>Administración de Evaluaciones</title>
<link href="/Leaderboard/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/bootstrap-spinner.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/datepicker3.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/select2.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/select2-bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="/Leaderboard/css/styles.css" rel="stylesheet" type="text/css"/>

<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/respond.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/bootstrap3-typeahead.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/jquery.spinner.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/locales/bootstrap-datepicker.es.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/bootstrap/jquery.blockUI.js"></script>

<!--[if lt IE 9]><script type="text/javascript" src="/Leaderboard/js/lib/angularjs/html5shiv-printshiv.min.js"></script><![endif]-->
<!--[if lt IE 8]><script type="text/javascript" src="/Leaderboard/js/lib/angularjs/json3.min.js"></script><![endif]-->

<script type="text/javascript" src="/Leaderboard/js/lib/select2.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/lib/angularjs/angularjs-1.2.16.min.js"></script>
<script type="text/javascript" src="/Leaderboard/js/controllers.init.js"></script>
<script type="text/javascript" src="/Leaderboard/js/controllers.admin.js"></script>
<script type="text/javascript" src="/Leaderboard/js/controllers.evaluaciones.js"></script>

<!--[if lte IE 8]>
<script type="text/javascript">
    $(document).ready(function() {
        angular.bootstrap(document);
    });
</script>
<![endif]-->
</head>
<body>
	<div ng-include="'/Leaderboard/include/header.html'"></div>
	
	<div class="container">
		<div ng-include="'/Leaderboard/include/changePassword.html'"></div>
	
		<div ng-controller="evaluacionesCtrl">
			<div ng-include="'/Leaderboard/include/messages.html'"></div>
			<div class="panel panel-primary">
				<div class="panel-heading"><h3 class="panel-title">Administraci&oacute;n de Evaluaciones</h3></div>
				<div class="panel-body panel-body-scrollable">
					<form role="form" class="form-horizontal">
						<div class="form-group">
							<label class="col-sm-3 control-label">Seleccionar sucursal</label>
							<div class="col-sm-6">
								<select ng-change="getBranchEvals()" ng-options="branch.name for branch in branches" ng-model="branch" class="form-control ng-pristine ng-valid" name="branches" id="cmbBranches"></select>
							</div>
						</div>
					</form>
				
					<table class="table table-striped table-condensed table-bordered" ng-table="tableParams">
						<thead><tr><th>ID</th><th>Empleado</th><th>Sucursal</th><th>Fecha</th><th class="number-column">Ponderaci&oacute;n</th><th class="number-column">Nota</th><th colspan="2">Acciones</th></tr></thead>
						<tbody><tr ng-repeat="evl in evaluaciones | filter:filterText">
							<td>{{evl.evId}}</td><td>{{evl.userEmp}} - {{evl.empName}}</td><td>{{evl.branch}}</td><td>{{evl.fecha}}</td><td class="number-column">{{evl.ponderacion}} %</td><td class="number-column">{{evl.nota}}</td>
							<td>
								<span>
									<a class="link float-left" href="javascript:void(0);" ng-click="openEvalDialog('edit', evl)">Editar</a>
									&nbsp;
									<a class="link float-left" href="javascript:void(0);" ng-click="delEval(evl.evId)">Borrar</a>
								</span>
							</td>
						</tr></tbody>
					</table>
					<div class="wrap-center">
						<ul class="pagination">
							<li ng-class="paginator.hasPrevClass()"><a href="javascript:void(0);" ng-click="paginator.first(); getBranchEvals();">[ &laquo;</a></li>
							<li ng-class="paginator.hasPrevClass()"><a href="javascript:void(0);" ng-click="paginator.prev(); getBranchEvals();">&laquo;</a></li>
							<li ng-class="paginator.itemClass(pg)" ng-repeat="pg in paginator.pages()"><a href="javascript:void(0);" ng-click="paginator.toPage(pg); getBranchEvals();">{{paginator.itemDesc(pg)}}</a></li>
							<li ng-class="paginator.hasNextClass()"><a href="javascript:void(0);" ng-click="paginator.next(); getBranchEvals();">&raquo;</a></li>
							<li ng-class="paginator.hasNextClass()"><a href="javascript:void(0);" ng-click="paginator.last(); getBranchEvals();">&raquo; ]</a></li>
						</ul>
					</div>
				</div>
				<div class="panel-footer">
					<input id="evsSearch" name="evsSearch" class="form-control search-box" ng-model="paginator.filter" placeholder="Escriba el texto a buscar y presione ENTER" ng-enter="paginator.toPage(1); getBranchEvals();" />
					<button type="button" class="btn btn-default" ng-click="getBranchEvals()">Refrescar</button>
					<button type="button" class="btn btn-default" ng-click="openImportDialog()">
						<img src="/Leaderboard/images/page_excel.png" style="margin-top: -2px">
						Cargar desde Excel
					</button>
					<button type="button" class="btn btn-primary" ng-click="openEvalDialog('add', null)">Agregar nueva</button>
				</div>
			</div>
	
			<div class="modal fade" id="dlgAddEditEvl" role="dialog" aria-labelledby="dlgAddEditEvl" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<form id="addEvlForm" name="addEvlForm" class="form-horizontal" role="form">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								<h4 class="modal-title">Agregar/Editar Evaluaci&oacute;n</h4>
							</div>
							<div class="modal-body">
								<div ng-include="'/Leaderboard/include/modalMessages.html'"></div>
								<div class="form-group">
									<label for="txtUsuario" class="col-sm-4 control-label">Usuario</label>
									<div class="col-sm-8">
										<input id="txtUsuario" name="usuario" class="form-control" type="text" maxlength="150" width="150" 
												ng-model="addEvalData.usrName" autofocus required ng-disabled="loading || editEvalMode" autocomplete="off" autofocus />
									</div>
								</div>
								<div class="form-group">
									<label for="txtNota" class="col-sm-4 control-label">Nota</label>
									<div class="col-sm-8 input-append spinner" data-trigger="spinner">
										<input id="txtNota" name="nota" class="form-control" type="text" maxlength="5" width="5" 
												ng-model="addEvalData.nota" autofocus required ng-disabled="loading" data-rule="currency" />
									</div>
								</div>
								<div class="form-group">
									<label for="calFecha" class="col-sm-4 control-label">Fecha</label>
									<div class="col-sm-8">
										<input id="calFecha" name="fecha" class="form-control input-calendar" type="text" maxlength="10" width="10"
												ng-model="addEvalData.fecha" required ng-disabled="loading" />
									</div>
								</div>
								<div class="form-group">
									<label for="txtPonderacion" class="col-sm-4 control-label">Ponderaci&oacute;n</label>
									<div class="col-sm-8 input-append spinner" data-trigger="spinner">
										<input id="txtPonderacion" name="ponderacion" class="form-control" type="text" maxlength="5" width="5" 
												ng-model="addEvalData.ponderacion" required ng-disabled="loading" data-rule="currency" />
									</div>
								</div>
							</div>
							 <div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
								<button type="submit" class="btn btn-primary" ng-click="saveEvaluacion()" ng-disabled="loading || addEvlForm.$invalid">Guardar cambios</button>
							</div>
						</form>
					</div>
				</div>
			</div>
			
			<div class="modal fade" id="dlgImportEvs" role="dialog" aria-labelledby="dlgImportEvs" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<form id="importEvsForm" name="importEvsForm" class="form-horizontal" role="form" method="post" action="/Leaderboard/FileUploadServlet/uploadEvaluaciones" enctype="multipart/form-data">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								<h4 class="modal-title">Importar Evaluaciones</h4>
							</div>
							<div class="modal-body">
								<div ng-include="'/Leaderboard/include/modalMessages.html'"></div>
								<div class="form-group">
									<label for="upldFile" class="col-sm-4 control-label">Seleccionar archivo</label>
									<div class="col-sm-8">
										<input id="upldFile" name="fileName" class="form-control" type="file" accept="application/vnd.ms-excel" ng-disabled="loading" required />
										<span class="help-block">*Cargar archivos de tipo XLS o XLSX no mayores a 10MB</span>
									</div>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
								<button type="submit" class="btn btn-primary" ng-disabled="loading || importEvsForm.$invalid">Cargar evaluaciones</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>